JavaEE Patterns


go to main page

(0)What is Remote Facade Design Pattern?
(1)What is CAP theorem?
(2)What is Convention over configuration?
(3)How J2EE developement was simplified before introduction of annotations?
What is Remote Facade Design Pattern?
Provides a coarse-grained facade on fine-grained objects to improve efficiency over a network.

RemoteFacade combines several common methods into a single network message. So using Fowler's example from his book, if you have an interface for Address with separate setters for setCity() setZipcode(), setStreet(). That would be 3 remote calls to go over the network. Instead RemoteFacade turns that into 1 method setAddress(street, city, zip) which will only require 1 networked message passed and therefore it should take less time to invoke.

Exposure or fine-grained but remote methods to the clients has a heavy performance impact, which is a key reason why the remote view of CMP entity beans was ridiculous. Every single setter and getter invocation would cause remote communication. For the update of a single database row, several remote invocations would be necessary.
TOP
What is CAP theorem?
CAP theorem is all about tradeoffs. CAP theorem states that we should choose only two of the following three: According to the CAP theorem, a distributed system(Partition tolerance system) can be either consistent or available, but never both. You can increase the consistency by copying the data to dedicated peers, which will decrease the availability at the same time.

Also high partition tolerance and high availability imply less consistency.
TOP
What is Convention over configuration?
Convention over configuration (CoC also known as coding by convention) is a software design paradigm which in which runtime environment provides default behavior instead of asking developer to specify them.

For example, if there is a class Sale in the model, the corresponding table in the database is called "sale" by default.



Reduce the number of decisions necessary to develop a mainstream application and configure only behaviors that deviate from the established convention.
TOP
How J2EE developement was simplified before introduction of annotations?
Annotations were introduced in Java SE 5, but the trend towards simplifying coding practices through conventions that combine code and metadata was already apparent in J2EE. XDoclet ( http:// xdoclet.sourceforge.net ), an open source JavaDoc- driven code and configuration generator, extracted the metadata from the session bean class using custom JavaDoc tags. The redundant plumbing , such as the home interface, the remote interface , deployment descriptors, and even Data Transfer Objects (DTOs), were generated from conventions and metadata declared through JavaDoc.
TOP